package Java8.optional;

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.function.Predicate;

public class Optionalfilter {

    public static void main(String[] args) {

        List l = new ArrayList<>();
        l.add("1");
        l.add("2");
        l.add("3");

        Optional<PrimeMinister> pm = Optional.of(new PrimeMinister("Narendra Modi"));
        //Using Optional.filter
        Predicate<PrimeMinister> pmPredicate = p -> p.getName().length() > 15;
        System.out.println(pm.filter(pmPredicate));
    }


}